package com.li.general.buttons
{
import flash.events.MouseEvent;

public class FourFrameButton extends Button implements ISelectableBtn
{
    private var _selected:Boolean;

    public function FourFrameButton()
    {
        super();

        hit.addEventListener(MouseEvent.CLICK, hitClickHandler);
    }

    public function set selected(value:Boolean):void
    {
        _selected = value;
        hitMouseOverHandler(null);
    }
    public function get selected():Boolean
    {
        return _selected;
    }

    override protected function hitMouseOverHandler(evt:MouseEvent):void
    {
        if(_selected)
            gotoAndStop(4);
        else
            gotoAndStop(2)
    }

    override protected function hitMouseOutHandler(evt:MouseEvent):void
    {
        if(_selected)
            gotoAndStop(3);
        else
            gotoAndStop(1);
    }

    private function hitClickHandler(evt:MouseEvent):void
    {
        selected = !_selected;    
    }
}
}